<template>
  <div class="index">
    <el-row type="flex" class="row-bg" justify="space-between">
      <el-col :span="4">待办事项</el-col>
      <el-col :span="20">
        <el-tabs v-model="activeName" @tab-click="handleClick" class="">
          <el-tab-pane name="first">
            <span slot="label">
              <el-badge
                :value="allAlertTotal"
                v-if="allAlertTotal > 0"
                :max="99"
                class="item"
              >
                待处理预警
              </el-badge>
              <span v-else>待处理预警</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="second" v-if="!isEsUser()">
            <span slot="label">
              <el-badge
                :value="projectTotal"
                v-if="projectTotal > 0"
                :max="99"
                class="item"
              >
                待审核项目
              </el-badge>
              <span v-else>待审核项目</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="third" v-if="!isEsUser()">
            <span slot="label">
              <el-badge
                :value="companyTotal"
                v-if="companyTotal > 0"
                :max="99"
                class="item"
              >
                待审核企业
              </el-badge>
              <span v-else>待审核企业</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="eight" v-if="isEsUser()">
            <span slot="label">
              <el-badge
                :value="projectReviewTotal"
                v-if="projectReviewTotal > 0"
                :max="99"
                class="item"
              >
                项目审核
              </el-badge>
              <span v-else>项目审核</span>
            </span>
          </el-tab-pane>
          <el-tab-pane
            name="five"
            v-if="userType != 'DIRECTOR' && salaryNeedCheck"
          >
            <span slot="label">
              <el-badge
                :value="salaryCount"
                v-if="salaryCount > 0"
                :max="99"
                class="item"
              >
                工资表审核
              </el-badge>
              <span v-else>工资表审核</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="fourth" v-if="isEsUser()">
            <span slot="label">
              <el-badge
                :value="pendingComplaintTotal"
                v-if="pendingComplaintTotal > 0"
                :max="99"
                class="item"
              >
                待处理投诉
              </el-badge>
              <span v-else>待处理投诉</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="six" v-if="isEsUser() && userType != 'DIRECTOR'">
            <span slot="label">
              <el-badge
                :value="projectChangeReviewTotal"
                v-if="projectChangeReviewTotal > 0"
                :max="99"
                class="item"
              >
                项目状态变更审核
              </el-badge>
              <span v-else>项目状态变更审核</span>
            </span>
          </el-tab-pane>
          <el-tab-pane v-if="isEsUser() && userType != 'DIRECTOR'" name="seven">
            <span slot="label">
              <el-badge
                :value="securityReviewTotal"
                v-if="securityReviewTotal > 0"
                :max="99"
                class="item"
              >
                保证金退还审核
              </el-badge>
              <span v-else>保证金退还审核</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="nine" v-if="!isEsUser() && insurancsNeedCheck">
            <span slot="label">
              <el-badge
                :value="insurancsTotal"
                v-if="insurancsTotal > 0"
                :max="99"
                class="item"
              >
                工伤保险审核
              </el-badge>
              <span v-else>工伤保险审核</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="ten" v-if="isWhUser()">
            <span slot="label">
              <el-badge
                :value="commentCount"
                v-if="commentCount > 0"
                :max="99"
                class="item"
              >
                临近或延期诉求
              </el-badge>
              <span v-else>临近或延期诉求</span>
            </span>
          </el-tab-pane>
          <el-tab-pane name="eleven">
            <span slot="label">
              <el-badge
                :value="protectRightsTotal"
                v-if="protectRightsTotal > 0"
                :max="99"
                class="item"
              >
                维权纠纷处理
              </el-badge>
              <span v-else>维权纠纷处理</span>
            </span>
          </el-tab-pane>
          <!-- 黄石定制化需求 -->
          <el-tab-pane name="twelve" v-if="isHsUser()">
            <span slot="label">
              <el-badge
                :value="keepRightsCount"
                v-if="keepRightsCount > 0"
                :max="99"
                class="item"
              >
                五端维权
              </el-badge>
              <span v-else>五端维权</span>
            </span>
          </el-tab-pane>
        </el-tabs>
      </el-col>
    </el-row>
    <!-- 待处理预警 -->
    <div class="warning" v-if="activeName == 'first'">
      <el-row type="flex" class="row-warn" justify="space-between">
        <el-col :span="4" class="selects">
          <el-select
            v-model="status"
            @change="changeAlertStatus"
            placeholder="请选择开工状态"
            clearable
            filterable
          >
            <el-option
              v-for="item in statusOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-col>
        <el-col :span="20" class="infos" v-if="isEsUser()">
          严重程度(长时间未处理)：<span class="levelOne"></span>30天(含)内<span
            class="levelTwo"
          ></span
          >31-60天(含)内<span class="levelThree"></span>61天(含)以上
        </el-col>
        <el-col :span="20" class="infos" v-else>
          严重程度(长时间未处理)：<span class="levelOne"></span>15天(含)内<span
            class="levelTwo"
          ></span
          >16-30天(含)内<span class="levelThree"></span>31-60天(含)内<span
            class="levelFour"
          ></span
          >61天(含)以上
        </el-col>
      </el-row>
      <div
        :class="isEsUser() ? 'warnCar warnCarEs' : 'warnCar'"
        v-if="allAlertTotal > 0"
      >
        <el-carousel
          indicator-position="outside"
          height="150px"
          v-if="!isEsUser()"
        >
          <el-carousel-item
            v-for="(item, index) in alertDataPageRe"
            :key="index"
          >
            <el-row class="warnItem">
              <el-col
                :span="12"
                :class="getItemClass(i.size)"
                v-for="i in item"
                :key="i.code"
                @click.native="
                  skipAlert(i.num, i.code, '/home/project/constructAlertList')
                "
              >
                <el-row>
                  <el-col :span="14" class="text">{{ i.name }}</el-col>
                  <el-col :span="5" class="num">{{ i.num }}个</el-col>
                  <el-col :span="5" class="span"><span></span></el-col>
                </el-row>
              </el-col>
            </el-row>
          </el-carousel-item>
        </el-carousel>
        <el-row :gutter="20" v-else>
          <el-col
            :span="8"
            v-for="(item, index) in alertDataPageRe"
            :key="index"
          >
            <div class="esWarnItems" @click="skipWarnList(item.size)">
              <img
                class="bg"
                :src="require('@/assets/newHome/levelBg' + item.size + '.png')"
                alt=""
              />
              <img
                class="icon"
                :src="
                  require('@/assets/newHome/levelIcon' + item.size + '.png')
                "
                alt=""
              />
              <p class="num">{{ item.num }}</p>
              <p class="title">
                {{
                  item.size == 1
                    ? '红色预警'
                    : item.size == 2
                    ? '橙色预警'
                    : '黄色预警'
                }}(个)
              </p>
            </div>
          </el-col>
        </el-row>
      </div>
      <div class="nodata" v-else>暂无待处理预警</div>
    </div>
    <!-- 待审核项目 -->
    <div class="tobeCheck" v-if="['second'].includes(activeName)">
      <div v-if="projectTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in projectList"
          :key="item.id"
        >
          <el-col :span="20">{{ item.projectName }}</el-col>
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="
                checkProject(
                  item.id,
                  '/home/project/projectAuditList',
                  'projectDeclareDetail'
                )
              "
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="projectTotal > 4">
          <el-link
            type="primary"
            @click="
              checkProject(
                null,
                '/home/project/projectAuditList',
                'projectAuditList'
              )
            "
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待审核项目</div>
    </div>
    <!-- 待审核企业 -->
    <div class="tobeCheck" v-if="['third'].includes(activeName)">
      <div v-if="companyTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in companyList"
          :key="item.id"
        >
          <el-col :span="20">{{ item.name }}</el-col>
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="
                checkCompany(
                  item.name,
                  '/home/enterpriseSet/employerAuditList',
                  'employerAuditList'
                )
              "
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="companyTotal > 4">
          <el-link
            type="primary"
            @click="
              checkCompany(
                null,
                '/home/enterpriseSet/employerAuditList',
                'employerAuditList'
              )
            "
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待审核企业</div>
    </div>

    <!-- 待处理投诉 -->
    <div class="tobeCheck" v-if="['fourth'].includes(activeName)">
      <div v-if="pendingComplaintTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in pendingComplaintList"
          :key="item.id"
        >
          <el-col :span="20"
            >{{ item.createTimeStr }} 被投诉项目：{{ item.projectName }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="
                skipPendingComplaint(item, '/home/unpaidComplaint/esCaseList')
              "
              >去处理</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="pendingComplaintTotal > 4">
          <el-link
            type="primary"
            @click="
              skipPendingComplaint(
                'moreitem',
                '/home/unpaidComplaint/esCaseList'
              )
            "
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待处理投诉</div>
    </div>
    <!-- 项目审核 -->
    <div class="tobeCheck" v-if="['eight'].includes(activeName)">
      <div v-if="projectReviewTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in projectReviewList"
          :key="item.id"
        >
          <el-col :span="20"
            >{{ item.createTimeStr }} 申报区域：{{ item.areaName }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="skipProjectReview(item, '/home/oneCode/projectChecks')"
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="projectReviewTotal > 4">
          <el-link
            type="primary"
            @click="
              skipProjectReview('moreitem', '/home/oneCode/projectChecks')
            "
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待审核项目</div>
    </div>
    <!-- 工资表审核 -->
    <div class="tobeCheck" v-if="['five'].includes(activeName)">
      <div v-if="salaryCount > 0">
        <el-row class="tobeCheckItem" v-for="item in salaryList" :key="item.id">
          <el-col :span="20"
            >{{ item.year }}年{{ item.month }}月第{{ item.batchNo }}批次工资
            项目：{{ item.projectName }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link type="primary" @click="skipPayrollReview(item)"
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="salaryCount > 4">
          <el-link type="primary" @click="skipPayrollReview('moreitem')"
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待审核工资表</div>
    </div>
    <!-- 项目状态变更审核 -->
    <div class="tobeCheck" v-if="['six'].includes(activeName)">
      <div v-if="projectChangeReviewTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in projectChangeReviewTotalList"
          :key="item.id"
        >
          <el-col :span="20"
            >{{ item.createTimeStr }} 申请变更项目：{{
              item.projectName
            }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="
                skipProjectChangeReview(
                  item,
                  '/home/oneCode/projectStatusChange'
                )
              "
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="projectChangeReviewTotal > 4">
          <el-link
            type="primary"
            @click="
              skipProjectChangeReview(
                'moreitem',
                '/home/oneCode/projectStatusChange'
              )
            "
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待审核项目状态变更记录</div>
    </div>
    <!-- 保证金退还审核 -->
    <div class="tobeCheck" v-if="['seven'].includes(activeName)">
      <div v-if="securityReviewTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in securityReviewList"
          :key="item.id"
        >
          <el-col :span="20"
            >{{ item.createTimeStr }} 申请项目：{{ item.projectName }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="skipSecurityReview(item, '/home/oneCode/refundDeposit')"
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="securityReviewTotal > 4">
          <el-link
            type="primary"
            @click="
              skipSecurityReview('moreitem', '/home/oneCode/refundDeposit')
            "
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无保证金退还申请</div>
    </div>
    <!-- 工伤保险审核 -->
    <div class="tobeCheck" v-if="['nine'].includes(activeName)">
      <div v-if="insurancsTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in insurancsList"
          :key="item.id"
        >
          <el-col :span="20"
            >{{ item.insDate }} &nbsp;&nbsp;&nbsp;&nbsp;
            {{ item.projectName }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link
              type="primary"
              @click="
                checkInsurance(
                  item.projectName,
                  '/home/insurance/insuranceCheckList'
                )
              "
              >去审核</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="insurancsTotal > 4">
          <el-link
            type="primary"
            @click="checkInsurance(null, '/home/insurance/insuranceCheckList')"
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无工伤保险审核</div>
    </div>
    <!-- 临近案件 -->
    <div class="warninglast" v-if="activeName == 'ten'">
      <div class="warnCarlast">
        <el-carousel indicator-position="outside" height="194px">
          <el-carousel-item v-for="(item, index) in commentList" :key="index">
            <el-row class="warnItem">
              <el-col
                class="warnItems"
                :span="8"
                v-for="i in item"
                :key="i.code"
              >
                <el-row>
                  <el-col :span="24" class="text">{{ i.areaName }}</el-col>
                  <el-col :span="12" class="num">
                    <div>{{ i.normalNum }}</div>
                    <p>常规件</p>
                  </el-col>
                  <el-col :span="12" class="span">
                    <div>{{ i.importantNum }}</div>
                    <p>重点件</p>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>
    <!-- 维权纠纷处理 -->
    <div class="tobeCheck" v-if="['eleven'].includes(activeName)">
      <div v-if="protectRightsTotal > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in protectRightsList"
          :key="item.id"
        >
          <el-col :span="20">项目名称：{{ item.projectName }}</el-col>
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link type="primary" @click="checkProtectRights(item.id)"
              >去处理</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="protectRightsTotal > 4">
          <el-link type="primary" @click="checkProtectRights(null)"
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待处理维权纠纷</div>
    </div>
    <!-- 黄石五项维权 -->
    <div class="tobeCheck" v-if="['twelve'].includes(activeName)">
      <div v-if="keepRightsCount > 0">
        <el-row
          class="tobeCheckItem"
          v-for="item in keepRightsList"
          :key="item.id"
        >
          <el-col :span="20"
            >{{ item.statusDesc }}：{{ item.complaintName }}</el-col
          >
          <el-col :span="4" class="tobeCheckItemLink">
            <el-link type="primary" @click="checkKeepRights(item)"
              >去处理</el-link
            >
          </el-col>
        </el-row>
        <div class="tobeCheckLink" v-if="keepRightsCount > 4">
          <el-link type="primary" @click="checkKeepRights(null)"
            >查看全部 &gt;&gt;</el-link
          >
        </div>
      </div>
      <div class="nodata" v-else>暂无待处理五端维权</div>
    </div>
  </div>
</template>
<script>
import { mapActions, mapState } from 'vuex'

export default {
  name: 'TodoList',
  data() {
    return {
      activeName: 'first',
      status: 'STARTED',
      projectTotal: 0,
      projectList: [],

      allAlertTotal: 0,
      alertDataPageRe: [],

      companyTotal: 0,
      companyList: [],

      pendingComplaintTotal: 0,
      pendingComplaintList: [],
      salaryCount: 0,
      salaryList: [],

      projectChangeReviewTotal: 0,
      projectChangeReviewTotalList: [],

      securityReviewTotal: 0,
      securityReviewList: [],

      insurancsTotal: 0,
      insurancsList: [],

      projectReviewTotal: 0,
      projectReviewList: [],

      commentCount: 0,
      commentList: [],

      salaryNeedCheck: false,
      insurancsNeedCheck: false,

      protectRightsList: '', //维权纠纷列表
      protectRightsTotal: 0, //维权纠纷总数

      keepRightsCount: 5, //黄石五项维权总数
      keepRightsList: [
        {
          id: 'ff8080817f0c47fa017f258669c03770',
          projectName: '湖北会基网络科技有限公司',
        },
        { id: 2, projectName: '黄石市下陆区东方山街道办事处' },
        { id: 3, projectName: '中国十五冶阳新弘盛项目部三分部' },
        { id: 4, projectName: '湖北长安建设集团股份有限公司' },
      ],
    }
  },
  props: ['areaId', 'userType'],
  computed: {
    ...mapState(['statusOptions']),
  },
  watch: {
    areaId() {
      this.getAlertList(this.status)
      this.getProjectList()
      this.getCompanyList()
      this.getSalaryList()
      this.getInsurancsList()
      this.getCommentList(this.areaId)
      this.getSalaryDetail()
      this.getinsuranceDetail()
      // 维权纠纷
      this.getProtectRightsList()
      //五项维权
      this.getKeepRightsList()
    },
  },
  mounted() {
    this.getAlertList(this.status)
    this.getProjectList()
    this.getCompanyList()
    this.getSalaryList()
    this.getInsurancsList()
    this.getCommentList(this.areaId)
    this.getSalaryDetail()
    this.getinsuranceDetail()
    // 维权纠纷
    this.getProtectRightsList()
    //五项维权
    this.getKeepRightsList()
  },
  methods: {
    //预警跳转
    skipAlert(num, code, routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        if (num > 0) {
          this.$router.push({
            name: 'constructAlertList',
            path: '/home/project/constructAlertList',
            query: {
              alertType: code,
              //status: "01", //未处理
              areaId: this.areaId,
              projectStatus: this.status,
            },
          })
          this.$store.commit('CHANGE_SLIDER_NAME', {
            oldUrl: '/home/project/constructAlertList',
            newUrl: this.$router.currentRoute.fullPath,
          })
        } else {
          return
        }
      }
    },
    getItemClass(index) {
      if (index == 0) {
        return 'warnItemList warnItemList4'
      }
      if (index == 1) {
        return 'warnItemList warnItemList3'
      }
      if (index == 2) {
        return 'warnItemList warnItemList2'
      }
      if (index == 3) {
        return 'warnItemList warnItemList1'
      }
    },
    handleClick() {},
    changeAlertStatus(val) {
      this.getAlertList(val)
    },
    getAlertList(projectStatus) {
      this.axios({
        method: 'post',
        url: 'api-a/cs/alert/expand/alerttotal',
        data: {
          areaId: this.areaId,
          projectStatus,
        },
      }).then((res) => {
        if (!res.data.hasError) {
          let arr = []
          if (this.isEsUser()) {
            arr = res.data.result.alertDataES
          } else {
            arr = res.data.result.alertData
          }

          arr = arr.filter((item) => {
            return item.num > 0
          })
          if (arr) {
            arr.forEach((element) => {
              if (element.color == '#6D000E') {
                element.size = 0
              }
              if (element.color == '#D9001B') {
                element.size = 1
              }
              if (element.color == '#F59A23') {
                element.size = 2
              }
              if (element.color == '#F4E829') {
                element.size = 3
              }
            })
            this.alertDataPageRe = this.getTwoArray(
              arr.sort(this.compare('num')).sort(this.compare('size')),
              8
            )
            this.allAlertTotal = res.data.result.alertCountTotal
          }
        } else {
          this.$message.error('待处理预警数据获取失败')
        }
      })
    },
    compare(property) {
      return function (a, b) {
        var value1 = a[property]
        var value2 = b[property]
        return value2 - value1
      }
    },
    getTwoArray(arr, targetNums) {
      //原始数组长度
      const originalLen = arr.length
      if (!this.isEsUser()) {
        //计算需要循环次数
        const splitNums = Math.ceil(originalLen / targetNums)
        //定义最终输出数组
        let resArr = []
        //循环,使用slice方法,选择数组的一部分浅拷贝到一个新数组对象,且原始数组不会被修改
        for (let i = 0; i < splitNums; i++) {
          let _tempArr = arr.slice(i * targetNums, i * targetNums + targetNums)
          resArr.push(_tempArr)
        }
        return resArr
      } else {
        return arr
      }
    },
    //待审核项目列表
    getProjectList() {
      let params = {
        pageNo: 1,
        pageSize: 4,
        status: 'AUDIT',
        areaId: this.areaId,
      }
      this.axios
        .post('api-p/projectapplication/expand/listbypage', params)
        .then((res) => {
          if (!res.data.hasError) {
            this.projectTotal = res.data.result.totalCount
            this.projectList = res.data.result.results
          }
        })
    },
    //跳转项目审核
    checkProject(id, path, name) {
      if (this.accessControl(path) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name,
          path,
          query: {
            id: id,
            status: 'AUDIT', //待审核
            areaId: this.areaId,
            path: 'constructMonitorHome',
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/project/projectAuditList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //待审核企业
    getCompanyList() {
      let params = {
        pageNo: 1,
        pageSize: 4,
        status: 'PENDING',
        areaId: this.areaId,
      }
      this.axios
        .post('api-c/companyaudit/expand/findauditlist', params)
        .then((res) => {
          if (!res.data.hasError) {
            this.companyTotal = res.data.result.totalCount
            this.companyList = res.data.result.results
          }
        })
    },
    //跳转企业审核
    checkCompany(name, path, pageName) {
      if (this.accessControl(path) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          pageName,
          path,
          query: {
            name: name,
            pending: 'PENDING', //待审核
            areaId: this.areaId,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/enterpriseSet/employerAuditList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },

    //待审核工资表
    getSalaryList() {
      this.axios.post('api-s/stats/todoData').then((res) => {
        if (!res.data.hasError) {
          console.log(res.data)
          if (this.userType != 'DIRECTOR') {
            this.projectChangeReviewTotal = res.data.result.proStatusChangeCount
            this.projectChangeReviewTotalList =
              res.data.result.proStatusChangeList.splice(0, 4)

            this.salaryCount = res.data.result.salAppCount
            this.salaryList = res.data.result.salAppList.splice(0, 4)

            this.securityReviewTotal = res.data.result.depositRetCount
            this.securityReviewList = res.data.result.depositRetList.splice(
              0,
              4
            )
          }
          this.projectReviewTotal = res.data.result.proAppCount
          this.projectReviewList = res.data.result.proAppList.splice(0, 4)

          this.pendingComplaintTotal = res.data.result.complaintCount
          this.pendingComplaintList = res.data.result.complaintList.splice(0, 4)
        }
      })
    },
    //跳转项目申报列表页
    skipProjectReview(item, routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        if (item == 'moreitem') {
          this.$router.push({
            name: 'projectChecks',
            path: '/home/oneCode/projectChecks',
          })
        } else {
          this.$router.push({
            name: 'projectChecks',
            path: '/home/oneCode/projectChecks',
            query: {
              createTime: item.createTime,
              status: item.status,
              areaId: item.areaId,
            },
          })
        }
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/monitorPage/constructMonitorHome',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //跳转项目状态变更审核功能中该条数据的审核详情页；
    skipPayrollReview(item) {
      if (item == 'moreitem') {
        this.$router.push({
          name: 'salaryPayListTab',
          path: '/home/salaryDf/salaryPayListTab',
          query: {
            tab: 'payrollList',
          },
        })
      } else {
        this.$router.push({
          name: 'salaryPayListTab',
          path: '/home/salaryDf/salaryPayListTab',
          query: {
            projectName: item.projectName,
            year: item.year,
            month: item.month,
            status: 'JC_AUDIT',
            id: item.id,
            tab: 'payrollList',
          },
        })
      }
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/monitorPage/constructMonitorHome',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    //跳转项目状态变更审核功能中该条数据的审核详情页；
    skipPendingComplaint(item, routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        if (item == 'moreitem') {
          this.$router.push({
            name: 'esCaseList',
            path: '/home/unpaidComplaint/esCaseList',
          })
        } else {
          this.$router.push({
            name: 'esCaseList',
            path: '/home/unpaidComplaint/esCaseList',
            query: {
              projectName: item.projectName,
            },
          })
        }
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/monitorPage/constructMonitorHome',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //跳转项目状态变更审核功能中该条数据的审核详情页
    skipProjectChangeReview(item, routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        if (item == 'moreitem') {
          this.$router.push({
            name: 'projectStatusChange',
            path: '/home/oneCode/projectStatusChange',
          })
        } else {
          this.$router.push({
            name: 'projectStatusChange',
            path: '/home/oneCode/projectStatusChange',
            query: {
              projectName: item.projectName,
              auditStatus: 'WAIT',
            },
          })
        }
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/monitorPage/constructMonitorHome',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //跳转该条保证金退还数据的审核详情页
    skipSecurityReview(item, routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        if (item == 'moreitem') {
          this.$router.push({
            name: 'refundDeposit',
            path: '/home/oneCode/refundDeposit',
          })
        } else {
          this.$router.push({
            name: 'refundDeposit',
            path: '/home/oneCode/refundDeposit',
            query: {
              projectName: item.projectName,
            },
          })
        }
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/monitorPage/constructMonitorHome',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    // 获取工伤保险待审核列表
    getInsurancsList() {
      this.axios({
        method: 'post',
        url: 'api-e/cs/ins/expand/monitor/list',
        data: {
          status: 'AUDIT',
        },
      })
        .then((response) => {
          this.insurancsList = response.data.result.results.splice(0, 4)
          this.insurancsTotal = response.data.result.totalCount
        })
        .catch((error) => {})
    },
    // 跳转工伤保险审核
    checkInsurance(projectName, routerUrl) {
      var url, pageName
      pageName = 'insuranceCheckList'
      this.$router.push({
        name: pageName,
        path: routerUrl,
        query: {
          // pending: "PENDING", //待审核
          projectName: projectName,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: routerUrl,
        newUrl: this.$router.currentRoute.fullPath,
      })
      // }
    },
    //获取诉求 -- 武汉
    getCommentList(areaId) {
      if (!this.isWhUser()) {
        return false
      }
      this.commentCount = 0
      this.commentList = []
      this.axios.post('/api-r/rbp/righttotal', { areaId }).then((res) => {
        if (!res.data.hasError) {
          this.commentCount = res.data.result.count
          if (res.data.result.data.length) {
            this.commentList = this.getTwoArray(res.data.result.data, 6)
          }
        }
      })
    },
    // 工资是否需要审核
    getSalaryDetail() {
      this.axios
        .post('/api-m/paramconfig/expand/findCsConfigDetail', {
          areaId: localStorage.getItem('areaId'),
        })
        .then((response) => {
          if (!response.data.hasError) {
            let curData = response.data.result
            for (var i = 0; i < curData.length; i++) {
              if (curData[i].subcategory == '84') {
                let obj = curData[i]
                let objValue = obj.value.split(',')
                let objValue5 = objValue[1]
                if (objValue5 == 1) {
                  this.salaryNeedCheck = true
                }
              }
            }
          }
        })
    },
    // 工伤保险是否需要审核
    getinsuranceDetail() {
      this.axios({
        method: 'post',
        url: 'api-m/paramconfig/findbyname',
        data: {
          name: 'empInsAuditConfig',
        },
      }).then((res) => {
        if (!res.data.hasError) {
          if (res.data.result.value == '1') {
            this.insurancsNeedCheck = true
          } else {
            this.insurancsNeedCheck = false
          }
        } else {
          this.$message({
            type: 'error',
            message: response.data.errorMsg,
          })
        }
      })
    },
    /**
     * @description:
     * @param {*} code 3黄色/2橙色/1红色
     * @return {*}
     */
    skipWarnList(code) {
      let curTime = new Date().getTime()
      let yellowTime = curTime - 30 * 24 * 60 * 60 * 1000
      let yellowEndTime = curTime - 31 * 24 * 60 * 60 * 1000
      let orangeTime = curTime - 60 * 24 * 60 * 60 * 1000
      let orangeEndTime = curTime - 61 * 24 * 60 * 60 * 1000
      let curDate =
        new Date(curTime).getFullYear() +
        '-' +
        (new Date(curTime).getMonth() + 1) +
        '-' +
        new Date(curTime).getDate()
      let yellowDate =
        new Date(yellowTime).getFullYear() +
        '-' +
        (new Date(yellowTime).getMonth() + 1) +
        '-' +
        new Date(yellowTime).getDate()
      let yellowEndDate =
        new Date(yellowEndTime).getFullYear() +
        '-' +
        (new Date(yellowEndTime).getMonth() + 1) +
        '-' +
        new Date(yellowEndTime).getDate()
      let orangeDate =
        new Date(orangeTime).getFullYear() +
        '-' +
        (new Date(orangeTime).getMonth() + 1) +
        '-' +
        new Date(orangeTime).getDate()
      let orangeEndDate =
        new Date(orangeEndTime).getFullYear() +
        '-' +
        (new Date(orangeEndTime).getMonth() + 1) +
        '-' +
        new Date(orangeEndTime).getDate()
      let effectiveStartDate, effectiveEndDate
      switch (code) {
        case 3:
          effectiveStartDate = yellowDate
          effectiveEndDate = curDate
          break
        case 2:
          effectiveStartDate = orangeDate
          effectiveEndDate = yellowEndDate
          break
        case 1:
          effectiveStartDate = ''
          effectiveEndDate = orangeEndDate
          break
        default:
          break
      }
      this.$router.push({
        name: 'constructAlertProjectList',
        path: '/home/project/constructAlertProjectList',
        query: {
          effectiveStartDate,
          effectiveEndDate,
          projectStatus: this.status,
          status: '01',
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/project/constructAlertProjectList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    // 获取维权纠纷列表
    getProtectRightsList() {
      this.axios({
        method: 'post',
        url: 'api-r/rightscomplaint/expand/complaintTotal',
        data: {
          areaId: this.areaId,
        },
      }).then((response) => {
        this.protectRightsList = response.data.result.data.splice(0, 4)
        this.protectRightsTotal = response.data.result.count
      })
      // .catch(error => {
      // });
    },
    // 跳转工伤保险审核
    checkProtectRights(id) {
      if (id) {
        this.$router.push({
          path: '/home/events/dealDispute',
          name: 'dealDispute',
          query: {
            id: id,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/events/rightsList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      } else {
        this.$router.push({
          path: '/home/events/rightsList',
          name: 'rightsList',
          query: {
            status: '01',
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/events/rightsList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //跳转黄石五项维权页面列表或详情页
    checkKeepRights(item) {
      // return false
      if (item) {
        this.$router.push({
          path: '/home/unpaidComplaint/esCaseDetail',
          name: 'esCseDetail',
          query: {
            id: item.id,
            activeName: item.dataSource,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/unpaidComplaint/esCaseList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      } else {
        this.$router.push({
          path: '/home/unpaidComplaint/hsCaseListTab',
          name: 'hsCaseListTab',
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/unpaidComplaint/hsCaseListTab',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //获取黄石维权五项 数据
    getKeepRightsList() {
      this.axios
        .post('api-r/rightbackpay/expand/front/page', {
          areaId: this.areaId,
          pageNo: 1,
          pageSize: 4,
        })
        .then((res) => {
          if (!res.data.hasError) {
            this.keepRightsCount = res.data.result.totalCount
            this.keepRightsList = res.data.result.results
          } else {
            this.keepRightsCount = 0
            this.keepRightsList = []
          }
        })
    },
  },
}
</script>
<style lang="less" scoped>
.nodata {
  text-align: center;
  line-height: 200px;
  color: #333 !important;
  font-size: 14px;
}
.row-bg {
  height: 40px;
  line-height: 40px;
  border-bottom: 1px solid #e3e7e9;
  padding: 0 16px;
  .el-col {
    &:first-child {
      font-size: 16px;
      color: #333333;
      font-weight: 700;
      font-family: SourceHanSansCN-Bold;
    }
    &:last-child {
      text-align: right;
      font-size: 14px;
      color: #48a6ff;
      font-weight: 400;
    }
  }
}
.warning {
  .row-warn {
    height: 44px;
    line-height: 44px;
    border-bottom: 1px solid #e3e7e9;
    padding: 0 16px;
    .infos {
      font-size: 12px;
      text-align: right;
      span {
        width: 12px;
        height: 12px;
        display: inline-block;
        vertical-align: text-top;
        margin-left: 22px;
        margin-right: 6px;
        &:first-child {
          margin-left: 10px;
        }
      }
      .levelOne {
        background-color: #fc0;
      }
      .levelTwo {
        background-color: #ff9500;
      }
      .levelThree {
        background-color: #e02020;
      }
      .levelFour {
        background-color: #880909;
      }
    }
  }
  .warnCar {
    padding: 15px 16px 0;
    .warnItemList {
      cursor: pointer;
      &:nth-child(2n + 1) {
        padding-right: 10px;
      }
      &:nth-child(2n) {
        padding-left: 10px;
      }
      line-height: 30px;
      height: 30px;
      margin-bottom: 8px;
      font-size: 14px;
      .el-row {
        padding: 0 12px;
        background-color: rgba(224, 32, 32, 0.3);
      }
      .num,
      .span {
        text-align: right;
      }
      .span span {
        width: 12px;
        height: 12px;
        display: inline-block;
        background-color: #fc0;
      }
    }
    .warnItemList4 {
      .el-row {
        background-color: rgba(224, 32, 32, 0.3);
      }
      .num {
        color: #880909;
      }
      .span span {
        background-color: #880909;
      }
    }
    .warnItemList3 {
      .el-row {
        background-color: rgba(224, 32, 32, 0.1);
      }
      .num {
        color: #e02020;
      }
      .span span {
        background-color: #e02020;
      }
    }
    .warnItemList2 {
      .el-row {
        background-color: rgba(255, 149, 0, 0.1);
      }
      .num {
        color: #ff9500;
      }
      .span span {
        background-color: #ff9500;
      }
    }
    .warnItemList1 {
      .el-row {
        background-color: #f9f9f9;
      }
      .num {
        color: #ffcc00;
      }
      .span span {
        background-color: #ffcc00;
      }
    }
  }
  .warnCarEs {
    padding-top: 27px;
  }
  /deep/ .el-input__inner {
    background: #fff !important;
    width: 120px;
    border: none;
    padding-left: 0;
    // color: #999;
    font-weight: 400;
  }
}
.tobeCheck {
  padding: 16px;
  .tobeCheckItem {
    background-color: #f5f7fa;
    height: 37px;
    line-height: 37px;
    margin-bottom: 10px;
    padding: 0 24px;
    font-size: 14px;
    color: #333;
    &Link {
      text-align: right;
    }
  }
  .tobeCheckLink {
    text-align: center;
  }
  /deep/ .el-link::after {
    border: none;
  }
}
/deep/.el-tabs__header {
  margin-bottom: 0;
  .el-tabs__nav {
    float: right;
  }
}
/deep/.el-tabs__nav-wrap::after {
  height: 1px;
}
/deep/.el-badge__content.is-fixed {
  top: 9px;
  right: 2px;
}
/deep/ .el-tabs__active-bar {
  background-color: #409eff !important;
}
/deep/.el-tabs__item.is-top:last-child {
  margin-right: 20px !important;
}
.warninglast {
  padding: 16px 8px 0;
  .warnItems {
    padding: 0 8px;
    height: 88px;
    text-align: center;
    margin-bottom: 14px;
    .text {
      height: 24px;
      line-height: 24px;
      background-color: #e5e6e6;
      font-size: 14px;
      color: #333;
    }
    .num {
      border-right: 1px solid #e5e6e6;
    }
    .num,
    .span {
      background-color: #f9f9f9;
      height: 63px;
      padding-top: 8px;
      div {
        line-height: 28px;
        height: 28px;
        font-size: 28px;
      }
      p {
        font-size: 12px;
        line-height: 12px;
        margin-top: 5px;
      }
    }
    .span div {
      color: #e02020;
    }
  }
}
/deep/ .el-badge__content {
  background-color: #e02020;
}
/deep/.el-link {
  line-height: 20px;
  color: #409eff !important;
  &:after {
    background-color: #409eff !important;
  }
}
.el-link.is-underline:hover:after {
  border-bottom: 1px solid #409eff !important;
}
.esWarnItems {
  height: 140px;
  position: relative;
  z-index: 2;
  color: #fff;
  padding-top: 42px;
  cursor: pointer;
  .bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
  }
  .icon {
    position: absolute;
    // top: 0;
    // right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
  }
  .num {
    line-height: 32px;
    font-size: 32px;
    text-align: center;
    font-weight: 500;
  }
  .title {
    line-height: 14px;
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
  }
}
</style>
